package main

import (
	"fmt"

	"github.com/manticoresoftware/go-sdk/manticore"
)

func main() {
	cl := manticore.NewClient()
	cl.SetServer("127.0.0.1", 9312)
	_, err := cl.Open()
	if err != nil {
		panic(err)
	}

	res, err := cl.Sphinxql(`CREATE TABLE testrt ( title text, content text, gid integer)`)
	if err != nil {
		panic(err)
	}
	fmt.Println(res)

	res, err = cl.Sphinxql(`replace into testrt values(1,'my subject', 'my content', 15)`)
	if err != nil {
		panic(err)
	}
	fmt.Println(res)
	res, err = cl.Sphinxql(`replace into testrt values(2,'another subject', 'more content', 15)`)
	if err != nil {
		panic(err)
	}
	fmt.Println(res)
	res, err = cl.Sphinxql(`replace into testrt values(5,'again subject', 'one more content', 10)`)
	if err != nil {
		panic(err)
	}
	fmt.Println(res)

	res2, err := cl.Query("more|another", "testrt")
	if err != nil {
		panic(err)
	}

	fmt.Println(res2)
}
